/*
 * @Author: your name
 * @Date: 2022-02-11 12:15:42
 * @LastEditTime: 2022-02-11 12:52:42
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \es6\src\class\class.js
 */
class Ponit{
    constructor(x=1, y=2){
        this.x = x
        this.y = y
    }

    toString() {
        return `${this.x}+${this.y}=${this.x+this.y}`
    }

    toValue(name = 'x') {
        return this[name]
    }
}

const b = new Ponit(5,3)
console.log(b)
console.log(b.toValue())
console.log(b.toValue('y'))